<?php

include_once 'CodeObject.php';
include_once 'CommentStatementCollection.php';
include_once 'TypeMemberAttributes.php';

class TypeMember extends CodeObject
{
    public function __construct($name)
    {
        parent::__construct();
        $this->set_name($name);
        $this->Attributes = new TypeMemberAttributes();
    }
    
    public function __set($name, $value)
    {
        parent::__set($name, $value);
        
        if($name == 'Attributes')
        {
            $this->set_Attributes($value);
        }
    }
    
    public function __get($name)
    {
        $ret = parent::__get($name);
        
        if($ret != null)
        {
            return $ret;
        }
        
        if($name == 'Attributes')
        {
            return $this->get_Attributes();
        }
    }
    
    public function get_name()
    {
        return $this->name;
    }

    public function set_name($name)
    {
        $this->name = $name;
    }

    public function get_Attributes()
    {
        return $this->Attributes;
    }

    public function set_Attributes($attributes)
    {
        if($attributes instanceof Attributes)
        {
            $this->Attributes = $attributes;
        }
        else
        {
            throw new InvalidArgumentException(
                'The parameter must be an instance of the Attributes class.');
        }
    }    
    
    protected $Attributes;        
    protected $name;
}

?>
